<% include("../public/commonheader.html"){}%>
 <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">会员管理</a>
            <a>
              <cite>会员日志</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
 </div>

<div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                        </div>
                        <div class="layui-card-header">
                            <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
							<button class="layui-btn layui-btn-normal" onclick="clearAll()"><i class="iconfont">&#xe6f8;</i> 清空日志</button>
                        </div>
                        <div class="layui-card-body layui-table-body layui-table-main">
                            <table class="layui-table layui-form">
                                <thead>
                                  <tr>
                                    <th width="64">
                                      <input type="checkbox" lay-filter="checkall" name="" lay-skin="primary" title="ID">
                                    </th>
                                    <th>${L.username}</th><th>${L.mobile}</th><th>${L.email}</th><th>${L.regip}</th><th>${L.regdate}</th><th>${L.logintime}</th><th>${L.loginip}</th><th>${L.fromapp}</th><th>${L.operation}</th>
								  </tr>
                                </thead>
                                <tbody>
								<%for(list in lists){%>
                                  <tr log_id="${list.log_id!0}">
                                    <td><input type="checkbox" name="id" value="${list.log_id!0}" title="${list.log_id!0}" lay-skin="primary"/></td><td>${list.username!}</td><td>${list.mobile!}</td><td align="center">${list.email!}</td><td>${list.regip!0,ipFormat}</td><td>${list.regdate,timeFormat}</td><td>${list.login_time,timeFormat}</td><td>${list.login_ip!0,ipFormat}</td><td>${list.appname!}</td>
									<td class="td-manage">
                                       <a title="删除" onclick="record_del(this,'${list.log_id!0}')" href="javascript:;">
                                        <i class="layui-icon">&#xe640;</i>
                                      </a>
                                    </td>
                                  </tr>
								  <%}%>
                                </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                  <a href="${'/admin/memberlogs/index/page/1',url}">${L.firstpage}</a> 
                                   <%for(var i=pageinfo.s;i<=pageinfo.e;i++){
									  if(i==pageinfo.page){
									%>
									 <span class="current">${i}</span>
								     <%}else{%>
                                     <a href="${'/admin/memberlogs/index/page/'+i,url}">${i}</a> 
                                   <%}}%>
                                  <a href="${'/admin/memberlogs/index/page/'+pageinfo.pages,url}">${L.lastpage}</a> 
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div> 
<% include("../public/commonfooter.html"){}%>
<script type="text/javascript">
      layui.use(['laydate','form'], function(){
	    $ = layui.jquery;
        var laydate = layui.laydate;
        var  form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){

          if(data.elem.checked){
            $('tbody input[name="id"]').prop('checked',true);
          }else{
            $('tbody input[name="id"]').prop('checked',false);
          }
          form.render('checkbox');
        }); 
   });
        

/*用户-删除*/
      function record_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
          $.post(jkas.url("/admin/memberlogs/drop"),{id:id},function(result)
			  {  if(200==result.code)
			     {
				  $(obj).parents("tr").remove();
                  layer.msg('已删除!',{icon:1,time:1000});
				  }
				  else
				  {layer.msg('删除出错!',{icon:5,time:1000});
				  }
			  },"json");
              
          });
      }



      function delAll(argument) {
        var ids = [];

        // 获取选中的id 
        $('tbody input[name="id"]').each(function(index, el) {
            if($(this).prop('checked')){
               ids.push($(this).val())
            }
        });
  
        layer.confirm('确认要删除所选吗？',function(index){
            //捉到所有被选中的，发异步进行删除
			$.post(jkas.url("/admin/memberlogs/drop"),{ids:ids.toString()},function(result)
			  {  if(200==result.code)
			     {
                    layer.msg('删除成功', {icon: 1});
                    $(".layui-form-checked").not('.header').parents('tr').remove();
				 }
				  else
				  {layer.msg('删除出错!',{icon:5,time:1000});
				  }
			  },"json");
        });
      }

   function clearAll() {
       
        layer.confirm('确认要清空日志吗？',function(index){
            //捉到所有被选中的，发异步进行删除
			$.post(jkas.url("/admin/memberlogs/clear"),{},function(result)
			  {  if(200==result.code)
			     {
                    layer.msg('清空成功', {icon: 1});
                    location.reload();
				 }
				  else
				  {layer.msg('操作出错!',{icon:5,time:1000});
				  }
			  },"json");
        });
      }

</script>